#!/opt/php/bin/php
<?php
require_once 'TVB/ImageInfrastructure/Server/requires.php';

$source_file = '8195.jpg';
$export_file = 'test.jpg';
$target_width = 136;
$target_height = 76;
$resize_mode = ImageHelper::CROP;
$watermark = '';
$ret = ImageHelper::Export($source_file, $export_file, $target_width, $target_height, $resize_mode, $watermark);
var_dump($ret);
exit;

//////////////////////////////////////
///////// RequestRecall ///////////////
//////////////////////////////////////
$login_id = 'qqq';
$destination_id = 1;
$source_id = 684;
$width = 50;
$height = 50;
$resize_mode = 2;
$watermark = '';
$format = '2';
$export_arg = '85';
$callback_url = 'http://ii.api.tvb.com/callback.php';

$ret = ImageInfrastructure::RequestDistribute($login_id, $source_id, $width, $height, $resize_mode, $watermark, $format, $export_arg, $destination_id, $callback_url);
var_dump($ret);

$ret = ImageInfrastructure::RequestRecall($login_id, $source_id, $width, $height, $resize_mode, $watermark, $format, $export_arg, $destination_id);
var_dump($ret);
exit;

//////////////////////////////////////
///////// DeleteSource ///////////////
//////////////////////////////////////
$source_id = 684;
$ret = ImageInfrastructure::DeleteSource($source_id);
var_dump($ret);
exit;

$source_file = 'file/test.eps';
$export_file = 'file/bbbbb.jpg';
$target_width = 160;
$target_height = 90;
$resize_mode = ImageHelper::CROP;
$watermark = '';

$ret = ImageHelper::Export($source_file, $export_file, $target_width, $target_height, $resize_mode, $watermark);
var_dump($ret);
exit;

//////////////////////////////////////
/// GetExportImageUrlTroublesomely ///
//////////////////////////////////////
$source_id = 1;
$width = 100;
$height = 100;
$resize_mode = 2;
$watermark = '';
$format = 2;
$export_arg = 85;
$ret = ImageInfrastructure::GetExportImageUrlTroublesomely($source_id, $width, $height, $resize_mode, $watermark, $format, $export_arg);
var_dump($ret);
///exit;

///////////////////////////////
/// GetExportImageUrlEasily ///
///////////////////////////////
$export_id = 84;
$ret = ImageInfrastructure::GetExportImageUrlEasily($export_id);
var_dump($ret);
exit;

//////////////////////////////
//// GetSourceImageUrl ///////
//////////////////////////////
$source_id = 1;
$ret = ImageInfrastructure::GetSourceImageUrl($source_id);
var_dump($ret);
exit;

/*
$ii_client = new ImageInfrastructureClient();

$login_id = 'qoo';
$width = 100;
$height = 100;
$resize_mode = 2;
$watermark = '';
$format = '2';
$export_arg = '85';
$destination_id = '1';
$callback_url = 'http://ii.api.tvb.com/callback.php';

$source_id = $ii_client->upload($login_id, 'test.jpg');
echo "source_id: $source_id\n";

$export_id = $ii_client->requestDistribute($login_id, $source_id, $width, $height, $resize_mode, $watermark, $format, $export_arg, $destination_id, $callback_url);
echo "export_id: $export_id\n";

echo $ii_client->queryStatusEasily($export_id, $destination_id) . "\n" ;
*/
?>
